function doLatexTableWithSE(data,se,nameLatexFile,numDecimals,numDecimalsSE)
% ONLY FOR ONE COLUMN!
input.data = data; 

% we want a complete LaTex document
input.makeCompleteLatexDocument = 1;
input.dataFormat = {['%.',num2str(numDecimals),'f']};
% generate LaTex code
latex = latexTable(input);

% save LaTex code as file
fid=fopen([nameLatexFile,'.tex'],'w');
[nrows,ncols] = size(latex);
idx = 7:2:nrows; %rows with extra output
i = 0; 
for row = 1:nrows
    if any(row == idx) && i<size(data,1)
        i = i + 1;
        for j=1:size(data,2)
            if j == 1
                text = ['$\underset{\left(',num2str(se(i,j),['%.',num2str(numDecimalsSE),'f']),...
                    '\right) } {',num2str(data(i,j),['%.',num2str(numDecimals),'f']),'}$'];
            else
                text = [text,'&','$\underset{\left(',num2str(se(i,j),['%.',num2str(numDecimalsSE),'f']),...
                    '\right) } {',num2str(data(i,j),['%.',num2str(numDecimals),'f']),'}$'];
            end
        end
        fprintf(fid,'%s\n',[text,' \\']);
    else
        fprintf(fid,'%s\n',latex{row,:});
    end
end
fclose(fid);

end

